import { defineStore } from 'pinia'

export const testStore = defineStore('testStore', {
  state: () => {
    return {
      username: 'wangwu',
      phone: 13245678912,
      age: 66
    }
  },
  getters: {
    getUser(state) {
      return `用户名: ${state.username}, 电话号码: ${state.phone}, 年龄: ${state.age}`
    },
    getUsername(): string {
      return `用户名: ${this.username}`
    }
  },
  actions: {
    async findUser(username: string, age: number) {
      this.username = username
      this.age = age
    },
    changeUser(username: string, age: number) {
      this.username = username
      this.age = age
    }
  }
})
